#ifndef __POINT__H
#define __POINT__H
#include "Math.h"

template <class T>
class Point
{
public:
	Point(T nRow, T nCol) : m_nRow(nRow), m_nCol(nCol) {}
	Point() {}
	
	void Set(T nRow, T nCol) { m_nRow = nRow; m_nCol = nCol; }
	void Move(T nRow, T nCol) { m_nRow += nRow; m_nCol += nCol; }
	bool LessThan(Point p) const { return m_nRow < p.m_nRow || (m_nRow == p.m_nRow && m_nCol < p.m_nCol); }
	bool MoreThan(Point p) const { return m_nRow > p.m_nRow || (m_nRow == p.m_nRow && m_nCol > p.m_nCol); }
	
	T Row() const { return m_nRow; }
	T Col() const { return m_nCol; }
	
	template <class T2>
	operator Point<T2>() {
		return Point<T2>((T2)m_nRow, (T2)m_nCol);
	} 

	T Dist2From(Point *p) {
		return Math::PointDist2(m_nRow - p->m_nRow, m_nCol - p->m_nCol);
	}
private:
	T m_nRow, m_nCol;
};
#endif
